package com.dynamic.idea.quick.develop.plugin.utils;

import com.dynamic.idea.quick.develop.plugin.entity.base02.GeneralPackageStruct;
import com.dynamic.idea.quick.develop.plugin.enums.GeneralPackageStructTypeEnums;

import java.util.ArrayList;
import java.util.List;

/**
 * 通用结构的列表
 */
@Deprecated
public class GeneralStructUtils {

    /**
     * 生成实现的结构列表
     * @return
     */
    public static List<GeneralPackageStruct> getDefaultServiceStruct(){
        List<GeneralPackageStruct> generalStructList=new ArrayList<>();
        GeneralPackageStruct daoInterfaceStruct= getDaoInterfaceJava();

        // dao的接口
        generalStructList.add(daoInterfaceStruct);

        // MapperXml
        generalStructList.add(getMapperXml());

        // service
        generalStructList.add(getService());

        // service实现
        generalStructList.add(getServiceImpl());

        // provider实现
        generalStructList.add(getProviderImpl());

        return generalStructList;
    }


    /**
     * 生成provider的结构列表
     * @return
     */
    public static List<GeneralPackageStruct> getDefaultProviderStruct(){
        List<GeneralPackageStruct> generalStructList=new ArrayList<>();

        // provider的生命
        generalStructList.add(getProvider());

        return generalStructList;
    }

    /**
     * 得到java的dao的接口配置
     * @return
     */
    public static GeneralPackageStruct getDaoInterfaceJava(){
        GeneralPackageStruct generalStruct=new GeneralPackageStruct();
        generalStruct.setType(GeneralPackageStructTypeEnums.INTERFACE.getValue());
        generalStruct.setOrder(1);
        generalStruct.setPackageName("dao");
        return generalStruct;
    }

    /**
     * 得到MapperXML的配置
     * @return
     */
    public static GeneralPackageStruct getMapperXml(){
        GeneralPackageStruct generalStruct=new GeneralPackageStruct();
        generalStruct.setType(GeneralPackageStructTypeEnums.MAPPER_XML.getValue());
        generalStruct.setOrder(2);
        generalStruct.setPackageName("mapper");
        return generalStruct;
    }

    /**
     * 得到Service的配置
     * @return
     */
    public static GeneralPackageStruct getService(){
        GeneralPackageStruct generalStruct=new GeneralPackageStruct();
        generalStruct.setOrder(3);
        generalStruct.setType(GeneralPackageStructTypeEnums.INTERFACE.getValue());
        generalStruct.setPackageName("service");
//        generalStruct.setGenerateClassNameSuffix("Service");
        return generalStruct;
    }

    /**
     * 得到Service实现的配置
     * @return
     */
    public static GeneralPackageStruct getServiceImpl(){
        GeneralPackageStruct generalStruct=new GeneralPackageStruct();
        generalStruct.setOrder(4);
        generalStruct.setType(GeneralPackageStructTypeEnums.IMPLEMENTATION.getValue());
        generalStruct.setPackageName("service.impl");
        return generalStruct;
    }

    /**
     * 得到Service的配置
     * @return
     */
    public static GeneralPackageStruct getProviderImpl(){
        GeneralPackageStruct generalStruct=new GeneralPackageStruct();
        generalStruct.setOrder(5);
        generalStruct.setType(GeneralPackageStructTypeEnums.IMPLEMENTATION.getValue());
        generalStruct.setPackageName("provider");
        return generalStruct;
    }

    /**
     * 得到Service的配置
     * @return
     */
    public static GeneralPackageStruct getProvider(){
        GeneralPackageStruct generalStruct=new GeneralPackageStruct();
        generalStruct.setOrder(1);
        generalStruct.setType(GeneralPackageStructTypeEnums.INTERFACE.getValue());
        generalStruct.setPackageName("provider");
        return generalStruct;
    }

}
